<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
			var number = prompt('请输入班级人数');
			var sum = 0;
			var average = 0;
			for (var i = 1; i <= number; i++) {
				var score = prompt('请输入第' + i + '个学生成绩');
				sum = sum + parseFloat(score);
				
			}
            average = sum / number;
			alert('总成绩为' + sum);
			alert('平均成绩为' + average);
		</script>
	</head>
	<body>
	</body>
</html>
